package cn.lanqiao.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.lanqiao.entity.Fill_question;
import cn.lanqiao.entity.Judge_question;
import cn.lanqiao.entity.Multi_question;
import cn.lanqiao.service.AdminService;
/**
 * 学生管理模块
 * @author yejun
 */
@Service
public class AdminServiceImpl implements AdminService {

	@Autowired
	private cn.lanqiao.mapper.AdminMapper adminMapper;
	@Autowired
	private cn.lanqiao.mapper.StudentMapper studentMapper;
	@Autowired
	private cn.lanqiao.mapper.TeacherMapper teacherMapper;
	@Autowired
	private cn.lanqiao.mapper.Multi_questionMapper multi_questionMapper;
	@Autowired
	private cn.lanqiao.mapper.Judge_questionMapper judge_questionMapper;
	@Autowired
	private cn.lanqiao.mapper.Fill_questionMapper fill_questionMapper;

	@Override
	public Map<String, Object> totalUser() {
		Map<String,Object>  map = new HashMap<String,Object>();
		//管理员用户数
		int adminTotal = adminMapper.total();
		//学生用户数
		int studentTotal = studentMapper.total();
		//教师用户数
		int teacherTotal = teacherMapper.total();
		int total = adminTotal+studentTotal+teacherTotal;
		map.put("adminTotal", adminTotal);
		map.put("studentTotal", studentTotal);
		map.put("teacherTotal", teacherTotal);
		map.put("total", total);
		return map;
	}

	@Override
	public Map<String, Object> itemNumber() {
		Map<String,Object>  map = new HashMap<String,Object>();
		//选择题信息
		int multi_question = multi_questionMapper.count(null);
		//判断题信息
		int judge_question = judge_questionMapper.count(null);
		//填空题信息
		int fill_question = fill_questionMapper.count(null);
		int total = multi_question+judge_question+fill_question;
		map.put("multi_question", multi_question);
		map.put("judge_question", judge_question);
		map.put("fill_question", fill_question);
		map.put("total", total);
		return map;
	}
<<<<<<< HEAD
=======

	
>>>>>>> a0db96222127504221d4dc4b4cc0e85cb062efa0
	
	
	
	
	
}
